Page({
  data: {
  name:'',
  staffid:'',
  lst:{



  },
  info:'',


 

  },
  onLoad() {

var that=this;

  dd.getStorage({
  key: 'staffid',
  success: function(res) 
  { 
    //console.log(res.data);
  that.setData({

   staffid:res.data

  });
  dd.httpRequest({

        
          //提交工号和授权码，如果授权码和工号对上了就返回姓名，然后保存工号到缓存
          //url: 'https://oapi.dingtalk.com/user/getuserinfo?access_token=' + access_token + '&code=' + code,
        
          url:'http://ding.tida-lighting.com/api/leave/adjust?staffid='+res.data,
          success: function (res) {
         console.log(res.data.msg);

         // console.log(that.data.staffid);
          that.setData({
             lst:res.data.data,
            
          });
          that.setData({

            info:res.data.msg,

          });

         // console.log(res.data);
         },
        fail: (err) => {
           //dd.alert({content: JSON.stringify(err)})
           console.log(err);
        }

     });//发起结束
  },
  fail: function(res){
    dd.alert({content: res.errorMessage});
  }
});

  dd.getStorage({
  key: 'name',
  success: function(res) {
   // console.log(res.data);
  that.setData({
   name:res.data

  });
  },
  fail: function(res){
    dd.alert({content: res.errorMessage});
  }
});










  },
    adjusted:function(e){


console.log(e);

  var id =e.currentTarget.dataset.value.id;
  var hour=e.currentTarget.dataset.value.hours;
   dd.navigateTo({
       url:'../adjustdetail/adjustdetail?id='+id+'&hour='+hour,
        });


  },
   


  

});
